





<!DOCTYPE html>
<html class="writer-html5" lang="zh-CN" >
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>tvm.micro &mdash; tvm 0.8.dev1982 文档</title>
  

  
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/tlcpack_theme.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/tvm-logo-square.png"/>
  

  
  
  
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/translations.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <script type="text/javascript" src="../../../_static/js/tlcpack_theme.js"></script>
    <link rel="index" title="索引" href="../../../genindex.html" />
    <link rel="search" title="搜索" href="../../../search.html" />
    <link rel="next" title="tvm.contrib" href="contrib.html" />
    <link rel="prev" title="tvm.rpc" href="rpc.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    
<header class="header">
    <div class="innercontainer">
      <div class="headerInner d-flex justify-content-between align-items-center">
          <div class="headerLogo">
               <a href="https://tvm.apache.org/"><img src=https://tvm.apache.org/assets/images/logo.svg alt="logo"></a>
          </div>

          <div id="headMenu" class="headerNav">
            <button type="button" id="closeHeadMenu" class="navCloseBtn"><img src="../../../_static/img/close-icon.svg" alt="Close"></button>
             <ul class="nav">
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/community>Community</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/download>Download</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/vta>VTA</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/blog>Blog</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/docs>Docs</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmconf.org>Conference</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://github.com/apache/tvm/>Github</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmchinese.github.io/declaration_zh_CN.html>About-Translators</a>
                </li>
             </ul>
               <div class="responsivetlcdropdown">
                 <button type="button" class="btn-link">
                   ASF
                 </button>
                 <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                 </ul>
               </div>
          </div>
            <div class="responsiveMenuIcon">
              <button type="button" id="menuBtn" class="btn-menu"><img src="../../../_static/img/menu-icon.svg" alt="Menu Icon"></button>
            </div>

            <div class="tlcDropdown">
              <div class="dropdown">
                <button type="button" class="btn-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  ASF
                </button>
                <div class="dropdown-menu dropdown-menu-right">
                  <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                  </ul>
                </div>
              </div>
          </div>
       </div>
    </div>
 </header>
 
    <nav data-toggle="wy-nav-shift" class="wy-nav-side fixed">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../../../index.html">
          

          
            
            <img src="../../../_static/tvm-logo-small.png" class="logo" alt="Logo"/>
          
          </a>

          
            
            
                <div class="version">
                  0.8.dev1982
                </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption" role="heading"><span class="caption-text">如何开始</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../install/index.html">安装 TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contribute/index.html">贡献者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">用户引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../tutorial/index.html">User Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../how_to/index.html">How To Guides</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">开发者引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/tutorial/index.html">Developer Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/how_to/how_to.html">开发者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">架构指南</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../arch/index.html">Design and Architecture</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">主题引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../topic/microtvm/index.html">microTVM：裸机使用TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../topic/vta/index.html">VTA: Versatile Tensor Accelerator</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">参考指南</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../langref/index.html">语言参考</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Python API</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="runtime.html">tvm.runtime</a></li>
<li class="toctree-l2"><a class="reference internal" href="ndarray.html">tvm.runtime.ndarray</a></li>
<li class="toctree-l2"><a class="reference internal" href="error.html">tvm.error</a></li>
<li class="toctree-l2"><a class="reference internal" href="ir.html">tvm.ir</a></li>
<li class="toctree-l2"><a class="reference internal" href="ir.html#module-tvm.instrument">tvm.instrument</a></li>
<li class="toctree-l2"><a class="reference internal" href="ir.html#module-tvm.transform">tvm.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="target.html">tvm.target</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html">tvm.tir</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html#module-tvm.tir.transform">tvm.tir.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html#tvm-tir-analysis">tvm.tir.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html#module-tvm.tir.stmt_functor">tvm.tir.stmt_functor</a></li>
<li class="toctree-l2"><a class="reference internal" href="te.html">tvm.te</a></li>
<li class="toctree-l2"><a class="reference internal" href="te.html#module-tvm.te.hybrid">tvm.te.hybrid</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html">tvm.driver</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/index.html">tvm.relay</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/frontend.html">tvm.relay.frontend</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/nn.html">tvm.relay.nn</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/vision.html">tvm.relay.vision</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/image.html">tvm.relay.image</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/transform.html">tvm.relay.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/analysis.html">tvm.relay.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/backend.html">tvm.relay.backend</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/dataflow_pattern.html">tvm.relay.dataflow_pattern</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/testing.html">tvm.relay.testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="autotvm.html">tvm.autotvm</a></li>
<li class="toctree-l2"><a class="reference internal" href="auto_scheduler.html">tvm.auto_scheduler</a></li>
<li class="toctree-l2"><a class="reference internal" href="rpc.html">tvm.rpc</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">tvm.micro</a></li>
<li class="toctree-l2"><a class="reference internal" href="contrib.html">tvm.contrib</a></li>
<li class="toctree-l2"><a class="reference internal" href="graph_executor.html">tvm.contrib.graph_executor</a></li>
<li class="toctree-l2"><a class="reference internal" href="topi.html">tvm.topi</a></li>
<li class="toctree-l2"><a class="reference internal" href="vta/index.html">vta</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../links.html">Other APIs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../publications.html">Publications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../genindex.html">索引</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
      
      <nav class="wy-nav-top" aria-label="top navigation" data-toggle="wy-nav-top">
        
            <div class="togglemenu">

            </div>
            <div class="nav-content">
              <!-- tvm -->
              Table of content
            </div>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        

          




















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../index.html">Docs</a> <span class="br-arrow">></span></li>
        
          <li><a href="index.html">Python API</a> <span class="br-arrow">></span></li>
        
      <li>tvm.micro</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../../../_sources/reference/api/python/micro.rst.txt" rel="nofollow"> <img src="../../../_static//img/source.svg" alt="viewsource"/></a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="module-tvm.micro">
<span id="tvm-micro"></span><h1>tvm.micro<a class="headerlink" href="#module-tvm.micro" title="永久链接至标题">¶</a></h1>
<p>MicroTVM module for bare-metal backends</p>
<p><strong>函数：</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.autotvm_build_func" title="tvm.micro.autotvm_build_func"><code class="xref py py-obj docutils literal notranslate"><span class="pre">autotvm_build_func</span></code></a>()</p></td>
<td><p>A dummy build function which causes autotvm to use a different export format.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#tvm.micro.get_standalone_crt_dir" title="tvm.micro.get_standalone_crt_dir"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_standalone_crt_dir</span></code></a>()</p></td>
<td><p>Find the standalone_crt directory.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.export_model_library_format" title="tvm.micro.export_model_library_format"><code class="xref py py-obj docutils literal notranslate"><span class="pre">export_model_library_format</span></code></a>(mod, file_name)</p></td>
<td><p>Export the build artifact in Model Library Format.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#tvm.micro.generate_project" title="tvm.micro.generate_project"><code class="xref py py-obj docutils literal notranslate"><span class="pre">generate_project</span></code></a>(template_project_dir, …)</p></td>
<td><p>Generate a project for an embedded platform that contains the given model.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.create_local_graph_executor" title="tvm.micro.create_local_graph_executor"><code class="xref py py-obj docutils literal notranslate"><span class="pre">create_local_graph_executor</span></code></a>(graph_json_str, …)</p></td>
<td><p>Create a local graph executor driving execution on the remote CPU device given.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#tvm.micro.create_local_debug_executor" title="tvm.micro.create_local_debug_executor"><code class="xref py py-obj docutils literal notranslate"><span class="pre">create_local_debug_executor</span></code></a>(graph_json_str, …)</p></td>
<td><p>Create a local debug runtime driving execution on the remote CPU device given.</p></td>
</tr>
</tbody>
</table>
<p><strong>类：</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.AutoTvmModuleLoader" title="tvm.micro.AutoTvmModuleLoader"><code class="xref py py-obj docutils literal notranslate"><span class="pre">AutoTvmModuleLoader</span></code></a>(template_project_dir, …)</p></td>
<td><p>MicroTVM AutoTVM Module Loader</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#tvm.micro.GeneratedProject" title="tvm.micro.GeneratedProject"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GeneratedProject</span></code></a>(api_client, options)</p></td>
<td><p>Defines a glue interface to interact with a generated project through the API server.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.TemplateProject" title="tvm.micro.TemplateProject"><code class="xref py py-obj docutils literal notranslate"><span class="pre">TemplateProject</span></code></a>(api_client)</p></td>
<td><p>Defines a glue interface to interact with a template project through the API Server.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#tvm.micro.Session" title="tvm.micro.Session"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Session</span></code></a>([transport_context_manager, …])</p></td>
<td><p>MicroTVM Device Session</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.TransportLogger" title="tvm.micro.TransportLogger"><code class="xref py py-obj docutils literal notranslate"><span class="pre">TransportLogger</span></code></a>(name, child[, logger, level])</p></td>
<td><p>Wraps a Transport implementation and logs traffic to the Python logging infrastructure.</p></td>
</tr>
</tbody>
</table>
<p><strong>Exceptions:</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.UnsupportedInModelLibraryFormatError" title="tvm.micro.UnsupportedInModelLibraryFormatError"><code class="xref py py-obj docutils literal notranslate"><span class="pre">UnsupportedInModelLibraryFormatError</span></code></a></p></td>
<td><p>Raised when export_model_library_format does not support the given Module tree.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#tvm.micro.SessionTerminatedError" title="tvm.micro.SessionTerminatedError"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SessionTerminatedError</span></code></a></p></td>
<td><p>Raised when a transport read operationd discovers that the remote session is terminated.</p></td>
</tr>
</tbody>
</table>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.micro.autotvm_build_func">
<span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">autotvm_build_func</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.autotvm_build_func" title="永久链接至目标">¶</a></dt>
<dd><p>A dummy build function which causes autotvm to use a different export format.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.micro.AutoTvmModuleLoader">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">AutoTvmModuleLoader</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">template_project_dir</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(在 Python v3.10)"><span class="pre">pathlib.Path</span></a><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">project_options</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><span class="pre">dict</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.AutoTvmModuleLoader" title="永久链接至目标">¶</a></dt>
<dd><p>MicroTVM AutoTVM Module Loader</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>template_project_dir</strong> (<em>Union</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(在 Python v3.10)"><em>pathlib.Path</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – project template path</p></li>
<li><p><strong>project_options</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – project generation option</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.micro.get_standalone_crt_dir">
<span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">get_standalone_crt_dir</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a></span></span><a class="headerlink" href="#tvm.micro.get_standalone_crt_dir" title="永久链接至目标">¶</a></dt>
<dd><p>Find the standalone_crt directory.</p>
<p>Though the C runtime source lives in the tvm tree, it is intended to be distributed with any
binary build of TVM. This source tree is intended to be integrated into user projects to run
models targeted with –runtime=c.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p>The path to the standalone_crt</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.micro.export_model_library_format">
<span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">export_model_library_format</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mod</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">tvm.driver.build_module.OperatorModule</span><span class="p"><span class="pre">,</span> </span><span class="pre">tvm.relay.backend.executor_factory.AOTExecutorFactoryModule</span><span class="p"><span class="pre">,</span> </span><span class="pre">tvm.relay.backend.executor_factory.GraphExecutorFactoryModule</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">file_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(在 Python v3.10)"><span class="pre">pathlib.Path</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.export_model_library_format" title="永久链接至目标">¶</a></dt>
<dd><p>Export the build artifact in Model Library Format.</p>
<p>This function creates a .tar archive containing the build artifacts in a standardized
layout. It’s intended to allow downstream automation to build TVM artifacts against the C
runtime.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mod</strong> (<em>ExportableModule</em>) – The return value of tvm.build or tvm.relay.build.</p></li>
<li><p><strong>file_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – Path to the .tar archive to generate.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>file_name</strong> – The path to the generated .tar archive.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="tvm.micro.UnsupportedInModelLibraryFormatError">
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">UnsupportedInModelLibraryFormatError</span></span><a class="headerlink" href="#tvm.micro.UnsupportedInModelLibraryFormatError" title="永久链接至目标">¶</a></dt>
<dd><p>Raised when export_model_library_format does not support the given Module tree.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.micro.generate_project">
<span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">generate_project</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">template_project_dir</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(在 Python v3.10)"><span class="pre">pathlib.Path</span></a><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">module</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">tvm.driver.build_module.OperatorModule</span><span class="p"><span class="pre">,</span> </span><span class="pre">tvm.relay.backend.executor_factory.AOTExecutorFactoryModule</span><span class="p"><span class="pre">,</span> </span><span class="pre">tvm.relay.backend.executor_factory.GraphExecutorFactoryModule</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">generated_project_dir</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(在 Python v3.10)"><span class="pre">pathlib.Path</span></a><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><span class="pre">dict</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.generate_project" title="永久链接至目标">¶</a></dt>
<dd><p>Generate a project for an embedded platform that contains the given model.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>template_project_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(在 Python v3.10)"><em>pathlib.Path</em></a><em> or </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – Path to a template project containing a microTVM Project API server.</p></li>
<li><p><strong>generated_project_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(在 Python v3.10)"><em>pathlib.Path</em></a><em> or </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – Path to a directory to be created and filled with the built project.</p></li>
<li><p><strong>module</strong> (<em>ExportableModule</em>) – A runtime.Module exportable as Model Library Format. The value returned from tvm.relay.build
or tvm.build.</p></li>
<li><p><strong>options</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – If given, Project API options given to the microTVM API server found in both
template_project_path and generated_project_path.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>A class that wraps the generated project and which can be used to further interact with it.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.micro.GeneratedProject" title="tvm.micro.GeneratedProject">GeneratedProject</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.micro.GeneratedProject">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">GeneratedProject</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">api_client</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.GeneratedProject" title="永久链接至目标">¶</a></dt>
<dd><p>Defines a glue interface to interact with a generated project through the API server.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.micro.TemplateProject">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">TemplateProject</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">api_client</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.TemplateProject" title="永久链接至目标">¶</a></dt>
<dd><p>Defines a glue interface to interact with a template project through the API Server.</p>
<p><strong>Methods:</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.TemplateProject.generate_project" title="tvm.micro.TemplateProject.generate_project"><code class="xref py py-obj docutils literal notranslate"><span class="pre">generate_project</span></code></a>(graph_executor_factory, …)</p></td>
<td><p>Generate a project given GraphRuntimeFactory.</p></td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.micro.TemplateProject.generate_project">
<span class="sig-name descname"><span class="pre">generate_project</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">graph_executor_factory</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">project_dir</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.TemplateProject.generate_project" title="永久链接至目标">¶</a></dt>
<dd><p>Generate a project given GraphRuntimeFactory.</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.micro.create_local_graph_executor">
<span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">create_local_graph_executor</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">graph_json_str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mod</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.create_local_graph_executor" title="永久链接至目标">¶</a></dt>
<dd><p>Create a local graph executor driving execution on the remote CPU device given.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>graph_json_str</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – A string containing the graph representation.</p></li>
<li><p><strong>mod</strong> (<a class="reference internal" href="runtime.html#tvm.runtime.Module" title="tvm.runtime.Module"><em>tvm.runtime.Module</em></a>) – The remote module containing functions in graph_json_str.</p></li>
<li><p><strong>device</strong> (<a class="reference internal" href="runtime.html#tvm.runtime.Device" title="tvm.runtime.Device"><em>tvm.runtime.Device</em></a>) – The remote CPU execution device.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>A local graph executor instance that executes on the remote device.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.contrib.GraphExecutor</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.micro.create_local_debug_executor">
<span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">create_local_debug_executor</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">graph_json_str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mod</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dump_root</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.create_local_debug_executor" title="永久链接至目标">¶</a></dt>
<dd><p>Create a local debug runtime driving execution on the remote CPU device given.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>graph_json_str</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – A string containing the graph representation.</p></li>
<li><p><strong>mod</strong> (<a class="reference internal" href="runtime.html#tvm.runtime.Module" title="tvm.runtime.Module"><em>tvm.runtime.Module</em></a>) – The remote module containing functions in graph_json_str.</p></li>
<li><p><strong>device</strong> (<a class="reference internal" href="runtime.html#tvm.runtime.Device" title="tvm.runtime.Device"><em>tvm.runtime.Device</em></a>) – The remote CPU execution device.</p></li>
<li><p><strong>dump_root</strong> (<em>Optional</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – If given, passed as dump_root= to GraphModuleDebug.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>A local graph executor instance that executes on the remote device.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.contrib.GraphExecutor</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.micro.Session">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">Session</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">transport_context_manager</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">session_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'micro-rpc'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout_override</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.Session" title="永久链接至目标">¶</a></dt>
<dd><p>MicroTVM Device Session</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>config</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – configuration for this session (as generated by
<cite>tvm.micro.device.host.default_config()</cite>, for example)</p>
</dd>
</dl>
<p class="rubric">示例</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">c_mod</span> <span class="o">=</span> <span class="o">...</span>  <span class="c1"># some module generated with &quot;c&quot; as the target</span>
<span class="n">dev_config</span> <span class="o">=</span> <span class="n">micro</span><span class="o">.</span><span class="n">device</span><span class="o">.</span><span class="n">arm</span><span class="o">.</span><span class="n">stm32f746xx</span><span class="o">.</span><span class="n">default_config</span><span class="p">(</span><span class="s1">&#39;127.0.0.1&#39;</span><span class="p">,</span> <span class="mi">6666</span><span class="p">)</span>
<span class="k">with</span> <span class="n">tvm</span><span class="o">.</span><span class="n">micro</span><span class="o">.</span><span class="n">Session</span><span class="p">(</span><span class="n">dev_config</span><span class="p">)</span> <span class="k">as</span> <span class="n">sess</span><span class="p">:</span>
    <span class="n">micro_mod</span> <span class="o">=</span> <span class="n">sess</span><span class="o">.</span><span class="n">create_micro_mod</span><span class="p">(</span><span class="n">c_mod</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="tvm.micro.SessionTerminatedError">
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">SessionTerminatedError</span></span><a class="headerlink" href="#tvm.micro.SessionTerminatedError" title="永久链接至目标">¶</a></dt>
<dd><p>Raised when a transport read operationd discovers that the remote session is terminated.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.micro.TransportLogger">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.micro.</span></span><span class="sig-name descname"><span class="pre">TransportLogger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">child</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logger</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">level</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">20</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.TransportLogger" title="永久链接至目标">¶</a></dt>
<dd><p>Wraps a Transport implementation and logs traffic to the Python logging infrastructure.</p>
<p><strong>Methods:</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.TransportLogger.timeouts" title="tvm.micro.TransportLogger.timeouts"><code class="xref py py-obj docutils literal notranslate"><span class="pre">timeouts</span></code></a>()</p></td>
<td><p>Return TransportTimeouts suitable for use with this transport.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#tvm.micro.TransportLogger.open" title="tvm.micro.TransportLogger.open"><code class="xref py py-obj docutils literal notranslate"><span class="pre">open</span></code></a>()</p></td>
<td><p>Open any resources needed to send and receive RPC protocol data for a single session.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.TransportLogger.close" title="tvm.micro.TransportLogger.close"><code class="xref py py-obj docutils literal notranslate"><span class="pre">close</span></code></a>()</p></td>
<td><p>Release resources associated with this transport.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#tvm.micro.TransportLogger.read" title="tvm.micro.TransportLogger.read"><code class="xref py py-obj docutils literal notranslate"><span class="pre">read</span></code></a>(n, timeout_sec)</p></td>
<td><p>Read up to n bytes from the transport.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#tvm.micro.TransportLogger.write" title="tvm.micro.TransportLogger.write"><code class="xref py py-obj docutils literal notranslate"><span class="pre">write</span></code></a>(data, timeout_sec)</p></td>
<td><p>Write data to the transport channel.</p></td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.micro.TransportLogger.timeouts">
<span class="sig-name descname"><span class="pre">timeouts</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.TransportLogger.timeouts" title="永久链接至目标">¶</a></dt>
<dd><p>Return TransportTimeouts suitable for use with this transport.</p>
<p>See the TransportTimeouts documentation in python/tvm/micro/session.py.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.micro.TransportLogger.open">
<span class="sig-name descname"><span class="pre">open</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.TransportLogger.open" title="永久链接至目标">¶</a></dt>
<dd><p>Open any resources needed to send and receive RPC protocol data for a single session.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.micro.TransportLogger.close">
<span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.TransportLogger.close" title="永久链接至目标">¶</a></dt>
<dd><p>Release resources associated with this transport.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.micro.TransportLogger.read">
<span class="sig-name descname"><span class="pre">read</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout_sec</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.TransportLogger.read" title="永久链接至目标">¶</a></dt>
<dd><p>Read up to n bytes from the transport.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Maximum number of bytes to read from the transport.</p></li>
<li><p><strong>timeout_sec</strong> (<em>Union</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(在 Python v3.10)"><em>None</em></a><em>]</em>) – Number of seconds to wait for all <cite>n</cite> bytes to be received before timing out. The
transport can wait additional time to account for transport latency or bandwidth
limitations based on the selected configuration and number of bytes being received. If
timeout_sec is 0, read should attempt to service the request in a non-blocking fashion.
If timeout_sec is None, read should block until at least 1 byte of data can be returned.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>Data read from the channel. Less than <cite>n</cite> bytes may be returned, but 0 bytes should
never be returned. If returning less than <cite>n</cite> bytes, the full timeout_sec, plus any
internally-added timeout, should be waited. If a timeout or transport error occurs,
an exception should be raised rather than simply returning empty bytes.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(在 Python v3.10)">bytes</a></p>
</dd>
<dt class="field-even">引发</dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>TransportClosedError :</strong> – When the transport layer determines that the transport can no longer send or receive
    data due to an underlying I/O problem (i.e. file descriptor closed, cable removed, etc).</p></li>
<li><p><strong>IoTimeoutError :</strong> – When <cite>timeout_sec</cite> elapses without receiving any data.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.micro.TransportLogger.write">
<span class="sig-name descname"><span class="pre">write</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout_sec</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.micro.TransportLogger.write" title="永久链接至目标">¶</a></dt>
<dd><p>Write data to the transport channel.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(在 Python v3.10)"><em>bytes</em></a>) – The data to write over the channel.</p></li>
<li><p><strong>timeout_sec</strong> (<em>Union</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(在 Python v3.10)"><em>None</em></a><em>]</em>) – Number of seconds to wait for at least one byte to be written before timing out. The
transport can wait additional time to account for transport latency or bandwidth
limitations based on the selected configuration and number of bytes being received. If
timeout_sec is 0, write should attempt to service the request in a non-blocking fashion.
If timeout_sec is None, write should block until at least 1 byte of data can be
returned.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>The number of bytes written to the underlying channel. This can be less than the length
of <cite>data</cite>, but cannot be 0 (raise an exception instead).</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)">int</a></p>
</dd>
<dt class="field-even">引发</dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>TransportClosedError :</strong> – When the transport layer determines that the transport can no longer send or receive
    data due to an underlying I/O problem (i.e. file descriptor closed, cable removed, etc).</p></li>
<li><p><strong>IoTimeoutError :</strong> – When <cite>timeout_sec</cite> elapses without receiving any data.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>


           </div>
           
          </div>
          

<footer>

    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="contrib.html" class="btn btn-neutral float-right" title="tvm.contrib" accesskey="n" rel="next">下一个 <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="rpc.html" class="btn btn-neutral float-left" title="tvm.rpc" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> 上一个</a>
      
    </div>

<div id="button" class="backtop"><img src="../../../_static//img/right.svg" alt="backtop"/> </div>
<section class="footerSec">
    <div class="footerHeader">
      <ul class="d-flex align-md-items-center justify-content-between flex-column flex-md-row">
        <li class="copywrite d-flex align-items-center">
          <h5 id="copy-right-info">© 2020 Apache Software Foundation | All right reserved</h5>
        </li>
      </ul>

    </div>

    <ul>
      <li class="footernote">Copyright © 2020 The Apache Software Foundation. Apache TVM, Apache, the Apache feather, and the Apache TVM project logo are either trademarks or registered trademarks of the Apache Software Foundation.</li>
    </ul>

</section>
</footer>
        </div>
      </div>

    </section>

  </div>
  

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

  </body>
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
    <!-- Theme Analytics -->
    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-75982049-2', 'auto');
    ga('send', 'pageview');
    </script>

    
   

</body>
</html>